import { responseResult } from "@/types/api";
import { SendCommentParams, commentItem } from "@/types/api/comment";
import axios from "@/utils/request";

/**
 * 查询文章,活动,竞赛的详情信息
 * @param {string} activityId
 * @param {number} type
 * @param {string} page 当前页码
 * @param {string} limit 每页记录数
 * @returns
 */
export function getDetailCommentAPI(page: number, limit: number, activityId: string, type: number) {
  return axios.get<responseResult<commentItem[]>>(`/api/comment/findDetailComment/${page}/${limit}?activityId=${activityId}&type=${type}`);
}

/**
 * 发布评论
 * @param {string} params.activityId
 * @param {string} params.content
 * @param {string} params.type
 * @param {string} params.userName
 * @returns
 */
export function sendCommentAPI(params: SendCommentParams) {
  return axios.post<responseResult<{}>>(`/api/comment/send-comment`, params);
}
